home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / DEV / A-B / 606+gest.cpt / ErrMgr.p next >
Text File  |  1990-10-16  |  4KB  |  112 lines

  1. {    This file has been processed by The THINK Pascal Source Converter, v1.1.    }
  2.  
  3. {
  4. Created: Tuesday, August 2, 1988 at 12:26 PM
  5.     ErrMgr.p
  6.     Pascal Interface to the Macintosh Libraries
  7.  
  8.  
  9.     <<< ErrMgr - Error File Manager Routines Interface File >>> 
  10.     
  11.     
  12.     Copyright Apple Computer, Inc.    1987-1988
  13.     All rights reserved
  14.     
  15.     This file contains:
  16.     
  17.     InitErrMgr(toolname, sysename, Nbrs)  - ErrMgr initialization
  18.     CloseErrMgr()                          - Close ErrMgr message files
  19.     GetSysErrText(Nbr, Msg)               - Get a system error message for a number
  20.     GetToolErrText(Nbr, Insert, Msg)      - Get a tool error message for a number
  21.     AddErrInsert(insert, msgString)       - Add an insert to a message
  22.     
  23. }
  24.  
  25.  
  26. {$IFC UNDEFINED UsingIncludes}
  27. {$SETC UsingIncludes := 0}
  28. {$ENDC}
  29.  
  30.  
  31.     UNIT ErrMgr;
  32.     INTERFACE
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47. PROCEDURE InitErrMgr(toolErrFilename: Str255;sysErrFilename: Str255;showToolErrNbrs: BOOLEAN);
  48. { ErrMgr initialization.This must be done before using any other ErrMgr
  49. routine.  Set showToolErrNbrs to true if you want all tool messages to contain
  50. the error number following the message text enclosed in parentheses (e.g.,
  51. "<msg txt> ([OS] Error <n>)"; system error messages always contain the error
  52. number).  The toolErrFileName parameter is used to specify the name of a
  53. tool-specific error file, and should be the NULL or a null string if not used
  54. (or if the tool's data fork is to be used as the error file, see
  55. GetToolErrText for futher details). The sysErrFileName parameter is used to
  56. specify the name of a system error file, and should normally be the NULL or a
  57. null string, which causes the ErrMgr to look in the MPW Shell directory for
  58. "SysErrs.Err" (see GetSysErrText).}
  59.  
  60. PROCEDURE CloseErrMgr; C;
  61. { Ideally a CloseErrMgr should be done at the end of execution to make sure all
  62. files opened by the ErrMgr are closed.    You can let normal program termination
  63. do the closing.  But if you are a purist...
  64. }
  65.  
  66. PROCEDURE GetSysErrText(msgNbr: INTEGER;errMsg: StringPtr);
  67. (* Get the error message text corresponding to system error number errNbr from
  68. the system error message file (whose name was specified in the InitErrMgr
  69. call).    The text of the message is returned in errMsg and the function returns
  70. a pointer to errMsg.  The maximum length of the message is limited to 254
  71. characters.
  72.  
  73. Note, if a system message filename was not specified to InitErrMgr, then the
  74. ErrMgr assumes the message file contained in the file "SysErrs.Err".  This
  75. file is first accessed as " ( *ShellDirectory* )                                 SysErrs.Err" on the assumption that
  76. SysErrs.Err is kept in the same directory as the MPW Shell.  If the file
  77. cannot be opened, then an open is attempted on "SysErrs.Err" in the System
  78. Folder.*)
  79.  
  80. PROCEDURE AddErrInsert(insert: Str255;msgString: StringPtr); C;
  81. { Add another insert to an error message string.This call is used when more
  82. than one insert is to be added to a message (because it contains more than
  83. one '^' character).
  84. }
  85.  
  86. PROCEDURE GetToolErrText(msgNbr: INTEGER;errInsert: Str255;errMsg: StringPtr);
  87. (* Get the error message text corresponding to tool error number errNbr from
  88. the tool error message file (whose name was specified in the InitErrMgr
  89. call).    The text of the message is returned in errMsg and the function returns
  90. a pointer to errMsg.  The maximum length of the message is limited to 254
  91. characters.  If the message is to have an insert, then ErrInsert should be a
  92. pointer to it.    Otherwise it should be either be a null string or a NULL
  93. pointer.
  94.  
  95. Inserts are indicated in error messages by specifying a '^' to indicate where
  96. the insert is to be placed.
  97.  
  98. Note, if a tool message filename was not specified to InitErrMgr, then the
  99. ErrMgr assumes the message file contained in the data fork of the tool calling
  100. the ErrMgr.  This name is contained in the Shell variable ( *Command* )     and the
  101. value of that variable is used to open the error message file.*)
  102.  
  103.  
  104.  
  105.     { UsingErrMgr }
  106.  
  107.  
  108.     IMPLEMENTATION
  109. END.
  110.  
  111.  
  112.